<template>
  <div class="child-box">
    <input type="text" v-model="msg"/>, 1秒后给父组件发消息，让他来获取子组件内的属性值
  </div>
</template>
<script>
export default {
  name: "TongxinChildRef",
  data() {
    return {
      msg:'',
      timer: null
    }
  },
  watch:{
    msg:function(){
      if(this.timer){
        clearTimeout(this.timer)
      }
      this.timer = setTimeout(()=>{
        this.$emit('receive-msg2')
      },1000)
    }
  }
}
</script>

<style scoped>
.child-box {
  border: 2px solid orangered;
  padding: 10px;
  margin-top: 10px;
  border-radius: 2px;
}
</style>
